package com.yinhai.msg.thirdPlatform.service.write.impl;

import com.yinhai.msg.thirdPlatform.entity.MsgThirdPlatformPo;
import com.yinhai.msg.thirdPlatform.mapper.write.MsgThirdPlatformWriteMapper;
import com.yinhai.msg.thirdPlatform.service.write.MsgThirdPlatformWriteService;
import com.yinhai.msg.thirdPlatform.vo.MsgThirdPlatformVo;
import com.yinhai.ta404.core.service.BaseService;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import com.yinhai.ta404.core.utils.UUIDUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author zhongrd
 * @file TODO
 * @date 2019/5/20 17:13
 */
@Service("msgThirdPlatformWriteService")
@TaTransactional
public class MsgThirdPlatformWriteServiceImpl extends BaseService implements MsgThirdPlatformWriteService {
    @Resource
    private MsgThirdPlatformWriteMapper msgThirdPlatformWriteMapper;

    /**
     * 新增第三方平台配置
     * @param msgThirdPlatformVo
     */
    @Override
    public void add(MsgThirdPlatformVo msgThirdPlatformVo) {
        msgThirdPlatformVo.setId(UUIDUtils.getUUID());
        msgThirdPlatformVo.setCreateTime(new Date());
        msgThirdPlatformVo.setUpdateTime(new Date());
        msgThirdPlatformWriteMapper.add(msgThirdPlatformVo.toPo(new MsgThirdPlatformPo()));
    }

    @Override
    public void deletePlatForm(String[] ids) {
        msgThirdPlatformWriteMapper.deletePlatform(ids);
    }
}
